package com.vision.sales.cl;

import com.google.gwt.core.client.GWT;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.vision.core.cl.ClientFactory;
import com.vision.core.cl.Services;
import com.vision.core.cl.ui.MainView;
import com.vision.core.cl.ui.MenuView;
import com.vision.core.cl.ui.ToolbarMenuViewImpl;
import com.vision.core.cm.serv.rpc.MenuService;
import com.vision.core.cm.serv.rpc.MenuServiceAsync;
import com.vision.sales.cl.resource.MenuIconProvider;
import com.vision.sales.cl.ui.SalesMainViewImpl;
import com.vision.sales.cl.ui.TabItemPanelBuilder;

/**
 * 
 * @author Mark
 *
 */
public class ClientFactoryImpl implements ClientFactory {
  
	private static final EventBus eventBus = new SimpleEventBus();
	private static final PlaceController placeController = new PlaceController(eventBus);
	private static final MenuView menuView = new ToolbarMenuViewImpl((MenuServiceAsync) Services.create(GWT.create(MenuService.class)), new MenuIconProvider());
	private static final MainView applicationView = new SalesMainViewImpl(new TabItemPanelBuilder());

	@Override
	public EventBus getEventBus() {
		return eventBus;
	}

	@Override
	public PlaceController getPlaceController() {
		return placeController;
	}
	
	@Override
	public MenuView getMenuView() {
		return menuView;
	}
	
	public MainView getMainView() {
		return applicationView;
	}

}
